package graph;

/**
 * this class will be the only one that can use a constructor to create a new graph.
 * It's the only class that can create a graph constructor too. 
 * If any class wants the graph, they will have to use this class
 * @author Mina
 *
 */
public class FacadeToObtainGraph
{
	private static FacadeToObtainGraph graphAdministrator;
	private BookReviewGraphInterface graph;
	
	private FacadeToObtainGraph()
	{
		AbstractBookReviewGraphConstructor graphConstructor =
								new BookReviewGraphConstructorFromTextFile();
		this.graph = graphConstructor.createGraph();
	}
	
	public static FacadeToObtainGraph getInstance()
	{
		if(graphAdministrator == null)
		{
			graphAdministrator = new FacadeToObtainGraph();
		}
		
		return graphAdministrator;
	}
	
	public BookReviewGraphInterface getGraph()
	{
		return this.graph;
	}
}
